package com.dly.hope.repository;

import com.dly.hope.modle.Friend;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface FriendRepository extends JpaRepository<Friend, String> {

    List<Friend> findAllByFriendGroupIdAndDataStatus(String friendGroupId, Integer dataStatus);

    Optional<Friend> findByIdAndFriendIdAndIsAgreeAndDataStatus(String id, String friendId, Integer isAgree, Integer dataStatus);

    List<Friend> findAllByFriendIdAndIsAgreeAndDataStatus(String friendId, Integer isAgree,Integer dataStatus);

    Optional<Friend> findTopByUserIdAndFriendIdAndDataStatus(String userId, String friendId, Integer dataStatus);

    List<Friend> findAllByFriendGroupIdInAndIsAgreeAndDataStatus(List<String> friendGroupIds, Integer isAgree,Integer dataStatus);

    List<Friend> findAllByUserIdAndIsAgreeAndDataStatus(String userId, Integer isAgree,Integer dataStatus);
}
